<?php

use yii\db\Query;
use console\db\channels\TransferTableMigration;

/**
 * 开屏动画转移
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class m300000_000000_t_app extends TransferTableMigration {

    /**
     * @inheritdoc
     */
    public $sourceDb = 'olddb';

    /**
     * @see TransferTableMigration
     * @inheritdoc
     */
    public function getTransferOptions() {
        return [
            'table' => [
                'app_splash' => 'app_boot_splash',
            ],
            'columns' => [
                'id',
                'name',
                'format' => function() {
                    return 'image';
                },
                'content' => function($data) {
                    return '/uploads/' . ltrim($data['path'], '/');
                },
                'url',
                'begin_time' => 'begintime',
                'end_time' => 'endtime',
                'listorder',
                'status' => function($data) {
                    if ($data['status'] > 0) {
                        return 10;
                    }
                    return $data['status'];
                },
                'created_at' => 'inputtime',
                'updated_at' => 'updatetime',
            ]
        ];
    }

}
